home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / IBPalettes / WWTCLKit / WWSliderCellIBInspector.m < prev    next >
Encoding:
Text File  |  1995-03-22  |  2.2 KB  |  83 lines

  1.  
  2. #import "WWSliderCell.h"
  3. #import "WWSliderCellIBInspector.h"
  4.  
  5. @implementation WWSliderCellIBInspector
  6.  
  7. - init 
  8. {
  9.    char buf[MAXPATHLEN + 1];
  10.    id bundle = [NXBundle bundleForClass:[WWSliderCell class]];
  11.     
  12.  
  13.    [super init];
  14.  
  15.    controlStringSize = 256;
  16.    controlString = (char *)NXZoneCalloc([self zone], controlStringSize, sizeof(char));
  17.  
  18.    tclExpressionSize = 256;
  19.    tclExpression = (char *)NXZoneCalloc([self zone], tclExpressionSize, sizeof(char));
  20.  
  21.    [bundle getPath:buf forResource:[[self class] name] ofType:"nib"];
  22.    [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
  23.  
  24.    // since the textView was "hidden" inside the ScrollView, we couldn't do this in IB, so...
  25.    [theControlStringText setDelegate:self];
  26.    [theTclExpressionText setDelegate:self];
  27.  
  28.    [self revert:self];
  29.  
  30.    return self;
  31. }
  32. //
  33. - free
  34. {
  35.   if (controlString) { NXZoneFree([self zone], controlString); }
  36.   if (tclExpression) { NXZoneFree([self zone], tclExpression); }
  37.   return [super free];
  38. }
  39. //
  40. - revert:sender 
  41. {
  42.   [theControlStringText setText:[object controlString]];
  43.   [theTclExpressionText setText:[object tclExpression]];
  44.   [theTclVar setStringValue:[object tclVar]];
  45.   [color setColor:[object color]];
  46.   return [super revert:sender];
  47. }
  48. //
  49. - ok:sender
  50. {
  51.   int   cnt;
  52.  
  53.   cnt = [theControlStringText textLength];
  54.   while (cnt >= controlStringSize)
  55.   {  controlStringSize *= 2;
  56.      controlString = (char *)NXZoneRealloc([self zone], controlString, controlStringSize);
  57.   }
  58.   *controlString = '\0';
  59.   [theControlStringText getSubstring:controlString start:0 length:(cnt + 1)];
  60.   [object setControlString:controlString];
  61.  
  62.   cnt = [theTclExpressionText textLength];
  63.   while (cnt >= tclExpressionSize)
  64.   {  tclExpressionSize *= 2;
  65.      tclExpression = (char *)NXZoneRealloc([self zone], tclExpression, tclExpressionSize);
  66.   }
  67.   *tclExpression = '\0';
  68.   [theTclExpressionText getSubstring:tclExpression start:0 length:(cnt + 1)];
  69.   [object setTclExpression:tclExpression];
  70.  
  71.   [object setTclVar:[theTclVar stringValue]];
  72.   [object setColor:[color color]];
  73.  
  74.   return [super ok:sender]; 
  75. }
  76. //
  77. - (BOOL)wantsButtons    { return YES; }
  78.  
  79. // text delegate methods
  80. - textDidChange:sender {  return [self touch:sender]; }
  81.  
  82. @end
  83.